<!DOCTYPE html>
<html lang="en">
<head>
    <title>答题</title>
    <meta charset="utf-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script src="/js/flexible_css.js,flexible.js.js"></script>
    <link rel="apple-touch-icon" href="/favicon.png">
    <link rel="Shortcut Icon" href="/favicon.png" type="image/x-icon">
    <link rel="stylesheet" href="/css/reset.css?rev=@@hash">
    <link rel="stylesheet" href="/css/style.css?rev=@@hash">

</head>
<body>



<div class="loading" style="background-color:#000"></div>

<div id="wrapper" class="wrapper_login displayFlex flexSit space_betweens spaceSize dasAutoSlight unitKind allInRoll cnimaLoop bokAutoIn cnimaLoop">
<!--    <div id="dtTitext" class="clearfix displayFlex flexSit space_betweens spaceSize dasAutoSlight unitKind allInRoll cnimaLoop bokAutoIn cnimaLoop bokAutoIn cfotkop animations fix fixes">-->
<!--        尊敬的用户<br>-->
<!--        为确保您获得更加个性化的活动体验，请您正确填写个人信息。若您属于某企业/单位，也请您根据实际情况填写企业/单位信息，这将有助于您更好的参与活动，感谢您的配合与支持!<br>-->
<!--        <strong>注意:企业/单位信息填写后不能修改，请认真谨慎填写</strong>-->
<!--    </div>-->
    <div id="scroller" style="height: 100%;">
        <div class="datiFormBox auto_censp">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名:</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" required  placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号:</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" required  placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单位名称:</label>
                    <div class="layui-input-block">
                        <input type="text" name="unitname" required  placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item" style="border-bottom: none">
                    <button type="button" class="layui-btn login_button layui-btn-fluid layui-btn-normal" lay-submit="" lay-filter="h5login" style="margin-top: 1rem;">进入主页</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="/js/zepto.min.js"></script>
<script src="/js/common.js"></script>
<script src="/js/iscroll.js"></script>
<script src="/js/call.js?rev=@@hash"></script>
<script src="/layui/layui.js"></script>
<script>
    layui.use(['form','jquery'], function () {
        var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer;


        // 进行登录操作
        form.on('submit(h5login)', function (data) {
            data = data.field;
            var str=/^[1][3,5,7,8][0-9]{9}$/;
            if (data.username == '') {
                layer.msg('用户名不能为空');
                return false;
            }
            if (data.phone == '' || str.test(data.phone)==false) {
                layer.msg('请检查手机号');
                return false;
            }
            if (data.unitname == '') {
                layer.msg('单位名称不能为空');
                return false;
            }
            $.ajax({
                type:'post',
                url:'/dth5/userLogin',
                data:{username:data.unitname+'-'+data.username,phone:data.phone,unitname:data.unitname},
                async: false,
                success:function (datas) {
                    if(datas.code==0){
                        localStorage.setItem("userId",datas.data);
                        window.location.replace("/dth5/intype");
                    }else{
                        layer.msg(datas.code);
                    }
                }
            });
            /*layer.msg('登录成功', function () {
                window.location = '../index.html';
            });*/
            return false;
        });
    });
</script>


</body>
</html>